Carbon


HOpen

Header: Files.h Carbon status: Supported

Opens the data fork of a file. Because HOpen also opens devices, it’s safer to use the HOpenDF function instead.

OSErr HOpen (
    SInt16 vRefNum, 
    SInt32 dirID, 
    ConstStr255Param fileName, 
    SInt8 permission, 
    SInt16 *refNum
);
vRefNum

A volume reference number, a working directory reference number, or 0 for the default volume.

dirID

A directory ID.

fileName

The name of the file.

permission

The access mode under which to open the file.

refNum

On return, a pointer to the file reference number of the opened file.

function result

A result code.

DISCUSSION

If you use HOpen to try to open a file whose name begins with a period, you might mistakenly open a driver instead; subsequent attempts to write data might corrupt data on the target device. To avoid these problems, you should always use HOpenDF instead of HOpen.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)